package hzk.codex2016.sort;

public class SelectionSorter implements Sorter {

	public void sort(int[] arr) {
		int tmp, min, i, j, n = arr.length;
		for (i = 0; i < n; ++i) {
			min = i;
			for (j = i + 1; j < n; ++j) {
				if (arr[j] < arr[min])
					min = j;
			}
			tmp = arr[i];
			arr[i] = arr[min];
			arr[min] = tmp;

		}
	}

	public static void main(String[] args) {
	
		Sorter s = new SelectionSorter();
		for (int i = 1; i < 10; i++) {
			Arrs.test(s, i);
		}
		for (int i = 100; i <= 110000; i *= 10) {
			Arrs.test(s, i);
		}
		for (int i = 1; i <= 5; i++) {
			Arrs.test(s, 1110000);
		}
	}

}
